package com.itheima.consumer.config;

import org.springframework.amqp.core.ExchangeBuilder;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.QueueBuilder;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class TopicConfig {

    /**
     * 声明交换机
     *
     * @return Topic类型交换机
     */
    @Bean
    public TopicExchange topicExchange() {
        //  return new TopicExchange("topic.exchange");
        return ExchangeBuilder.topicExchange("topic.exchange").build();
    }

    @Bean
    public Queue topicQueue1() {
        return new Queue("topic.queue1");
    }

    @Bean
    public Queue topicQueue2() {
        //   return new Queue("topic.queue2");
        return QueueBuilder.durable("topic.queue2").build();
    }

}
